# main: main.c hello.c hello.h
# 	gcc main.c hello.c -o main
# 	./main
# 	rm main
CC:=gcc
CFLAGS := -g -O0 -Wall
log:=thirdparty/log/log.h thirdparty/log/log.c

log_test: test/log_test.c $(log)
	-gcc $^ -o $@ -I thirdparty
	-./$@
	-rm $@

#$^：依赖列表
#$@：目标文件名
#-I：给gcc配置包含的查看路径

json:=thirdparty/cJSON/cJSON.h thirdparty/cJSON/cJSON.c
json_test: test/json_test.c $(json) $(log)
	-$(CC) $(CFLAGS) $^ -o $@ -I thirdparty
#	-./$@
#	-rm $@

app_common:=app/app_common.h app/app_common.c
app_common_test: test/app_common_test.c $(app_common) $(log)
	-$(CC) $^ -o $@ -I app -I thirdparty
	-./$@
	-rm $@

app_message:=app/app_message.h app/app_message.c
app_message_test: test/app_message_test.c $(app_message) $(log) $(app_common) $(json)
	-$(CC) $^ -o $@ -I app -I thirdparty
	-./$@
	-rm $@


mqtt_test: test/mqtt_test.c
	-$(CC) $^ -o $@ -lpaho-mqtt3c
	-./$@
	-rm $@


# -L是指定用到的下载库

app_mqtt:=app/app_mqtt.h app/app_mqtt.c
app_mqtt_test: test/app_mqtt_test.c $(app_mqtt) $(log)
	-$(CC) $^ -o $@ -Iapp -Ithirdparty -lpaho-mqtt3c
	-./$@
	-rm $@



